home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / qlib205.zip / QLIB.ZIP / INC / QLIB.INC < prev    next >
Text File  |  1997-04-25  |  5KB  |  160 lines

  1. .386
  2. .387
  3. .model flat,c  ;back to using C calling convention !!!
  4. assume fs:flat,gs:flat    ;MASM thought you won't need these in flat mode!!!
  5.                           ; by default they are assumed to ERROR !!!!
  6.  
  7. #include _str_.tmp  ;used by PASM for strings within ASM code
  8.  
  9. .code
  10. getint proto v:byte    ;ax:edx=segment:offset
  11. setint proto v:byte,s:word,off:dword
  12. getrmint proto v:byte  ;ax:dx=segment:offset
  13. setrmint proto v:byte,s:word,off:word
  14. alloc_callback proto off:dword,calls:dword,typ:byte   ;off=your_proc  calls=offset rmcs callstruct <>
  15.   CB_RETF equ 0
  16.   CB_IRET equ 1
  17. free_callback proto _seg:word,off:word
  18. _iret proto calls:dword  ;used to end a callback proc, iret stack frame
  19. _retf proto calls:dword  ;used to end a callback proc, retf stack frame
  20. alloc_phys proto :dword,:dword
  21. free_phys proto :dword
  22. lock_ram proto off:dword,siz:dword
  23. unlock_ram proto off:dword,siz:dword
  24. lock_all proto :byte    ;returns amount locked
  25. uninitall proto  ;uninit everything thru atexit
  26. setmode50 proto
  27.  
  28. irq_enable proto irqn:byte
  29. irq_disable proto irqn:byte
  30.  
  31. pack_init proto,siz:word,packs:word  ;siz=# of entries(files)alloced for
  32. pack_uninit proto
  33. pack_open proto,strg:dword  ;opens a packed file
  34. pack_open_hdr proto,strg:dword,hdr:dword  ;opens a packed file (w/ header already loaded)
  35. pack_close proto,:word
  36. .data
  37. externdef _os_typ:byte
  38. externdef _os_ver_major:byte
  39. externdef _os_ver_minor:byte
  40. externdef _dos_ver_major:byte
  41. externdef _dos_ver_minor:byte
  42. externdef _dosXver:word   ;version (BCD coded)
  43. externdef _dosXtyp:byte   ;DOS extender type (0=PMODEW 1=DOS/4GW 2=DOS32)
  44.   DOSX_PMODEW equ 0
  45.   DOSX_DOS4GW equ 1
  46.   DOSX_DOS32 equ 2        ;not implemented any more
  47.   DOSX_UNKNOWN equ 255
  48. externdef errno:word
  49. externdef selcode:word
  50. externdef seldata:word
  51. externdef selzero:word
  52. externdef _environ:dword    ;relative addr
  53. externdef _psp:dword        ;relative addr to PSP
  54. externdef _dta:dword        ;relative addr to DTA  (it's not in your PSP)
  55. externdef _base:dword       ;base of program
  56. externdef _fpu:byte         ;80387?
  57. externdef _8087:byte        ;WATCOM support
  58. externdef _argstr:byte ;129 dup (?)
  59. externdef _argv:dword ;64 dup (?)
  60. externdef _argc:byte
  61. externdef _pmmode:byte
  62.   SRV_DPMI equ 3
  63.   SRV_VCPI equ 2
  64.   SRV_XMS equ 1
  65.   SRV_RAW equ 0
  66. externdef _filename:dword
  67. externdef _ds_:word
  68. externdef _es_:word
  69. externdef _8kbufferseg:word
  70. externdef _8kbuffer:dword
  71. externdef _processor:byte  ; processor type : 3=386 4=486 5=586
  72. externdef _cpu:byte        ; processor type : same
  73.  
  74. NULL equ 0
  75. ERROR equ -1
  76. NULLPROC proto
  77.  
  78. callstruct struct   ;50 bytes  (32h)
  79.   _edi dd ?     ;0
  80.   _esi dd ?     ;4
  81.   _ebp dd ?     ;8
  82.   _res dd ?     ;0ch reserved
  83.   _ebx dd ?     ;10h
  84.   _edx dd ?     ;14h
  85.   _ecx dd ?     ;18h
  86.   _eax dd ?     ;1ch
  87.   _flg dw ?     ;20h flags
  88.   _es dw ?      ;22h segments (NOT selectors)
  89.   _ds dw ?      ;24h "
  90.   _fs dw ?      ;26h "
  91.   _gs dw ?      ;28h "
  92.   _ip dw ?      ;2ah ignored in some calls
  93.   _cs dw ?      ;2ch "
  94.   _sp dw ?      ;2eh must be 0 to use system stacks
  95.   _ss dw ?      ;30h "
  96. callstruct ends
  97.  
  98. qptr equ qword ptr
  99. dptr equ dword ptr
  100. wptr equ word ptr
  101. bptr equ byte ptr
  102.  
  103. dma_s struct
  104.   siz dd ?      ;00h    DWORD   region size
  105.   off dd ?      ;04h    DWORD   offset
  106.   sel dw ?      ;08h    WORD    segment/selector
  107.   id dw ?       ;0Ah    WORD    buffer ID
  108.   phys dd ?     ;0Ch    DWORD   physical address
  109.   dmach dw ?    ; This is used by QLIB only!
  110. dma_s ends
  111.  
  112. dma_alloc64 proto dmas:dword  ;max=64k
  113. dma_alloc128 proto dmas:dword ;max=128k
  114. dma_free proto dmas:dword
  115.  
  116. ;Win95+ funcs
  117. win95_title_set proto,:dword
  118. win95_title_get proto,:dword,:dword
  119. win95_vmtitle_set proto,:dword
  120. win95_vmtitle_get proto,:dword,:dword
  121. win95_close_enable proto
  122. win95_close_disable proto
  123. win95_close_query proto
  124. win95_close_ack proto
  125. win95_close_cancel proto
  126.  
  127. WIN95_CLOSE_NOACK equ 0
  128. WIN95_CLOSE_ACK equ 1
  129.  
  130. .code
  131. include callp.inc
  132.  
  133. ;INVOKE sucks!
  134. ;so I made callp macro which does exactly what masm's INVOKE does but mine
  135. ; works!
  136. ;may not be as fast but it always works!! (now that I got all the bugs out)
  137. ;plus you can call proc whose addr is held in a variable. Couldn't do that
  138. ;before.
  139. ;this is slower because all vars are widen to dwords even if not needed
  140.  
  141. ;CALLP Ver 1.05
  142. ; NEW ver 1.05 : Fixed a bug in destroy_ax thingy
  143. ; NEW ver 1.04 : Now capable of pushing REAL 10 (QLIB v2.00 Beta#4)
  144. ; NEW ver 1.03 : Fixed a bug I added in Ver 1.02 (stupid!) (push (a3) is bad)
  145. ;              : Sept 7/96
  146. ; NEW ver 1.02 : Fixed major bug !!! if arg was offset x+4 size was == 8 ???
  147. ;              : also capable of FWORD (aug 25/96)
  148. ; NEW ver 1.01 : Now capable of pushing REAL 8 and other bugs fixed
  149.  
  150. ; Known bugs : as of Nov 30/96 I've found too many bugs and now have designed
  151. ;              it garbage.  I don't know how to fix these bugs
  152. ; 1) if there is a forward reference in the varargs then MASM causes an error
  153. ; 2) callp never uses movsx which is bad!
  154. ; see callp.inc if you wanna look at it
  155.  
  156. ; Too many bugs, that cannot be fixed cause MASM sux!
  157. ; Use callp on your own risk, if you know when you can't use INVOKE use this
  158.  
  159.  
  160.